<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	VisitorForm form = (VisitorForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String staffname = user.getName();
	String staffid = user.getEmployId();
	String dept = request.getAttribute("dept")+"";
%>

<div>
	<form id="appointAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/visitor/doAddAppoint" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>预约访客登记</li>
			</ul>
		</div>
		<table class="formTable">			
			<tr>
				<td class="tdTitle">预约访客姓名：</td>
				<td>
					<input class="inputText xs" type="text" placeholder="必填项" value="" name="vname"  AUTOCOMPLETE="off" >
					<span class="errorTipWrap" id="errorTip_vname"></span>
				</td>
				
			</tr>
			<tr>
				<td class="tdTitle">预约时间：</td>
				<td>
					<input class="inputText xs" type="text" value="" name="appointtime" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',startDate:'%y-%M-%d 08:00:00'})">
					<span class="errorTipWrap" id="errorTip_appointtime"></span>
				</td>
				
			</tr>
			<tr>
				<td class="tdTitle">证件类型：</td>
				<td>
					<select id="certtype" class="easyui-combobox" data-options="required:true,showSeconds:false" name="certtype" style="width:200px;">
						<option value="0">身份证</option>
						<option value="1">其它</option>
					</select>
				</td>
			</tr>
			
			<tr>
				<td class="tdTitle">证件号码：</td>
				<td>
					<input class="inputText xs" type="text" placeholder="证件号码与联系电话必填其一"  value="" name="cert">
				</td>
			</tr>
			<tr>
				<td class="tdTitle">访客单位：</td>
				<td>
					<input class="inputText xs" type="text"  value="" name="units">
				</td>
			</tr>
			<tr>
				<td class="tdTitle">访客人数：</td>
				<td>
					<input class="inputText xs" type="text" style="width:20px" value="1" name="peoplenum" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
				</td>
			</tr>
			<tr>
				<td class="tdTitle">联系电话：</td>
				<td>
					<input class="inputText xs" type="text" placeholder="证件号码与联系电话必填其一" value="" name="phone" onkeyup="value=value.replace(/[^\w&=]|_/ig,'')" onblur="value=value.replace(/[^\w&-]|_/ig,'')">
				</td>
			</tr>
			<tr>
				<td class="tdTitle">被访人：</td>
				<td>
					<input class="inputText xs" type="text"  value="" name="byvisitor">
				</td>
			</tr>
			<tr>
				<td class="tdTitle">被访部门：</td>
				<td>
					<select id="depa" class="easyui-combobox" name="depa" style="width:200px;">					
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">事由：</td>
				<td>
					<select id="aim" class="easyui-combobox" name="aim" style="width:200px;">
						<option value="业务洽谈">业务洽谈</option>
						<option value="应聘">应聘</option>
						<option value="访友">访友</option>
						<option value="安装与维修">安装与维修</option>
						<option value="参观">参观</option>
						
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">备注：</td>
				<td>
					<input class="inputText xs" type="text"  value="" name="remark">
				</td>
			</tr>
			<tr>
				<td class="tdTitle"></td>
				<td class="" colspan="2">
					<div class="checkbox-wrap">
						<label>
							<input type="checkbox" value="1" name="vaudit" class="checkbox">
							<span>确认访问公司，若不确认保安不能查询。</span>
						</label>						
					</div>
				</td>
			</tr>			
			<tr>
				<td class="tdTitle" style="color: red">提示：</td>
				<td><span>若提交信息有误，只能在预约访客访问公司前可以编辑与删除！</span></td>				
			</tr>
			<input type="hidden" name="staffname" value="<%=staffname%>">
			<input type="hidden" name="staffid" value="<%=staffid%>">
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Visitor.listMyAppoint(<%=user.getEmployId()+"" %>)">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<script type="text/javascript">
	var depa = <%= dept%>
	$(document).ready(function(){
		for(var i=0;i<depa.length;i++){
    		$('#depa').append("<option value="+depa[i].dept+">"+depa[i].dept+"</option>");    		    		
    	}
	});
	var staffid = <%=staffid%>
	$(document).ready(XF.Visitor.bigAutocomp(staffid))
	
</script>





